package com.hbut.bili.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.hbut.bili.entity.Video;
import com.hbut.bili.service.VideoService;

public class VideoShowServlet extends HttpServlet {

	private VideoService videoService = new VideoService();
	
	@Override
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		Long aid = Long.parseLong(request.getParameter("aid"));
		Video video = new Video();
		try {
			video = videoService.selectVideoById(aid);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		request.setAttribute("video", video);
		
		request.getRequestDispatcher("view/videoShow.jsp").forward(request, response);
	}

}
